{% sw_extends '@Storefront/storefront/component/product/feature/base.html.twig' %}

{% block component_product_feature_list_item_base_content_label %}
    {{ 'component.product.feature.label.%s'|format(label)|sw_sanitize|trans }}
{% endblock %}

{% block component_product_feature_list_item_base_content_value %}
    {% set isLength = label in ['height', 'width', 'length'] %}
    {% set isWeight = label == 'weight' %}
    {% set usesMeasurementUnit = isLength or isWeight %}

    {% if label == 'releaseDate' %}
        {{ value|sw_sanitize|date('Y-m-d') }}
    {% elseif usesMeasurementUnit %}
        {% set fromUnit = isWeight ? 'kg' : 'mm' %}
        {{ value|sw_sanitize|sw_convert_unit(fromUnit) }}
    {% else %}
        {{ value|sw_sanitize }}
    {% endif %}
{% endblock %}
